package com.neusoft.neuiotms.dcam.workflow.converter;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcam.workflow.dto.PeifaItemSLDTO;
import com.neusoft.neuiotms.dcam.workflow.model.PeifaItemSL;

@Component
public class PeifaItemSLConverter extends AbstractConverter<PeifaItemSL, PeifaItemSLDTO> {

    @Override
    public PeifaItemSL toModel(final PeifaItemSLDTO dto) {

        final PeifaItemSL model = new PeifaItemSL();

        model.setName(dto.getName());
        model.setCode(dto.getCode());
        model.setSpecifications(dto.getSpecifications());
        model.setSerialnumber(dto.getSerialnumber());
        model.setBigTypeName(dto.getBigTypeName());
        model.setBigTypeCode(dto.getBigTypeCode());
        model.setMiddleTypeName(dto.getMiddleTypeName());
        model.setMiddleTypeCode(dto.getMiddleTypeCode());
        model.setSmallTypeName(dto.getSmallTypeName());
        model.setSmallTypeCode(dto.getSmallTypeCode());
        model.setPeifaUserCode(dto.getPeifaUserCode());
        model.setPeifaUserName(dto.getPeifaUserName());
        model.setPeifaLocation(dto.getPeifaLocation());
        model.setPeifaLocationName(dto.getPeifaLocationName());
        model.setPeifaQuantity(dto.getPeifaQuantity());
        model.setStatus(dto.getStatus());

        return model;
    }

    @Override
    public PeifaItemSLDTO toDTO(final PeifaItemSL model, final boolean forListView) {
        final PeifaItemSLDTO dto = new PeifaItemSLDTO();
        dto.setId(model.getId());
        dto.setName(model.getName());
        dto.setCode(model.getCode());
        dto.setSpecifications(model.getSpecifications());
        dto.setSerialnumber(model.getSerialnumber());
        dto.setBigTypeName(model.getBigTypeName());
        dto.setBigTypeCode(model.getBigTypeCode());
        dto.setMiddleTypeName(model.getMiddleTypeName());
        dto.setMiddleTypeCode(model.getMiddleTypeCode());
        dto.setSmallTypeName(model.getSmallTypeName());
        dto.setSmallTypeCode(model.getSmallTypeCode());
        dto.setPeifaUserCode(model.getPeifaUserCode());
        dto.setPeifaUserName(model.getPeifaUserName());
        dto.setPeifaLocation(model.getPeifaLocation());
        dto.setPeifaLocationName(model.getPeifaLocationName());
        dto.setPeifaQuantity(model.getPeifaQuantity());
        dto.setStatus(model.getStatus());
        return dto;
    }

}
